import requests


def getJson(url, parames):
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'}
    r = requests.post(url, headers=headers, params=parames)
    return r.json()


while True:
    inp = input('请输入要翻译的单词：')
    parames = {'kw': inp}
    Json = getJson('https://fanyi.baidu.com/sug', parames)
    for info in Json['data']:
        print(info)


